import uniqueId from '@form-create/utils/lib/unique'
import { localeProps } from '../../utils'

const label = '富文本'
const name = 'DkTinyEditor'

export default {
  menu: 'high',
  icon: 'icon-park:align-text-center-one',
  label,
  name,
  event: ['blur', 'focus', 'change', 'input', 'clear'],
  rule() {
    return {
      type: name,
      field: uniqueId(),
      title: '富文本',
      info: '',
      $help: '',
      $required: false,
      props: {}
    }
  },
  props(_, { t }) {
    return localeProps(t, name + '.props', [
      {
        type: 'inputNumber',
        field: 'height',
        title: '高度',
        value: 400
      },
      {
        type: 'switch',
        field: 'document',
        title: '文档效果',
        value: false
      },
      {
        type: 'input',
        field: 'buttonText',
        title: '按钮文字',
        value: '编辑富文本'
      },
      {
        type: 'inputNumber',
        field: 'showDialogWidth',
        title: '弹窗宽度',
        value: 300,
        effect: {
          help: '如果宽度小于当前值，则会自动变为弹窗'
        }
      }
    ])
  }
}
